﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.Extensions.Configuration;
using Steeltoe.Extensions.Configuration.ConfigServer;

namespace Gmmy.Utility
{
    public static class GlobalSetting
    {
        public static string EntityFrameworkConnectionString { get; set; }
        public static string ExceptionlessService { get; set; }
        public static string ExceptionlessKey { get; set; }
        static GlobalSetting()
        {
            var builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory()+ "/Configs/").
                AddJsonFile("AppSettings.json", false, true)
                .AddConfigServer("env");
            var config = builder.Build();
            EntityFrameworkConnectionString = config.GetSection("settings:sqlconnection").Value;
            ExceptionlessService = config.GetSection("settings:exceptionlessservice").Value;
            ExceptionlessKey = config.GetSection("settings:exceptionlesskey").Value;
        }
    }
}
